988C - Equal Sums - CodeForces Solution


implementation sortings *1400

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>
using namespace std;
#define Orton     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define el endl
#define loop for(int j=0;j<n;j++)
#define tt int t,n;cin>>t;while(t--)
/*اللهم صل وسلم على نبينا محمد*/
int main() {
    Orton
    int k;
    cin >> k;
    vector<pair<int, pair<int, int>>> v;
    for (int i = 0; i < k; ++i) {
        int n, s = 0;
        cin >> n;
        vector<int> a(n);
        loop {cin >> a[j];s += a[j];}
        loop v.push_back({s - a[j], {i, j}});
    }
    sort(v.begin(), v.end());bool no = true;
    for (int i = 0; i < v.size() - 1; ++i) {
        if (v[i].first == v[i + 1].first && (v[i].second.first != v[i + 1].second.first)) {
            cout << "YES\n" << v[i + 1].second.first + 1 << " " << v[i + 1].second.second + 1 << el<< v[i].second.first + 1 << " " << v[i].second.second + 1;
            no = false;break;
        }
    }
    if (no)cout << "NO";
}


Comments

Submit
0 Comments
More Questions

1140D - Minimum Triangulation
75C - Modified GCD
1722A - Spell Check
1722B - Colourblindness
1722D - Line
1722C - Word Game
1722G - Even-Odd XOR
552E - Vanya and Brackets
933A - A Twisty Movement
1722F - L-shapes
1196B - Odd Sum Segments
1325D - Ehab the Xorcist
552B - Vanya and Books
1722E - Counting Rectangles
168A - Wizards and Demonstration
168B - Wizards and Minimal Spell
7A - Kalevitch and Chess
912B - New Year's Eve
1537C - Challenging Cliffs
879B - Table Tennis
1674E - Breaking the Wall
1282A - Temporarily unavailable
1366C - Palindromic Paths
336A - Vasily the Bear and Triangle
926A - 2-3-numbers
276D - Little Girl and Maximum XOR
1253C - Sweets Eating
1047A - Little C Loves 3 I
758D - Ability To Convert
733A - Grasshopper And the String